package com.androider.timememory.utils;

import android.app.Activity;
import android.util.DisplayMetrics;

public class DeviceUtil {
	
	private static DisplayMetrics dm;

	/**
	 * Get screen width
	 * @param activity
	 * @return
	 */
	public static int getScreenWidth(Activity activity){
		if(null == dm){
			dm = new DisplayMetrics();  
			activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
		}
	    return dm.widthPixels;
	}
	
	/**
	 * Get screen height
	 * @param activity
	 * @return
	 */
	public static int getScreenHeight(Activity activity){
		if(null == dm){
			dm = new DisplayMetrics();  
			activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
		}
	    return dm.heightPixels;
	}
}
